vscode launch
.vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Go Project",
"type": "go",
"request": "launch",
"mode": "auto", // 可选:"debug", "test", "exec"
"program": "${workspaceFolder}/main.go", // 入口文件
"args": [
"arg1",
"arg2"
], // 运行时参数
"env": {
"ENV_VAR1": "value1",
"ENV_VAR2": "value2"
},
"cwd": "${workspaceFolder}/", // 设置工作目录
"buildFlags": "-tags=customTag", // 编译标志
"trace": "verbose" // 可选:"verbose"(显示详细调试信息)
}
]
}